<?php
use yii\helpers\Html;
use yii\helpers\Url;
use yii\widgets\DetailView;
use kartik\editable\Editable;

$this->title = '合同详情';
$this->params['breadcrumbs'][] = ['label' => '合同列表', 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>

<style type="text/css">
    .content-view{padding:10px 20px;margin-top:5px; border:1px solid #d2d6de}  
    .view-one{margin-top: 5px;}  
</style>

<div class="contract-view">

    <div class="box">
        <div class="box-header">
            财务
        </div>

         <div class="box-body"> 
            <div class="content-view">

                <div class="row view-one">
                    <div class="col-md-3">
                        <label>合同编号：</label><?=$model->code?>
                    </div>
                    <div class="col-md-3">
                        <label>创建人：</label><?=$model->userName?>
                    </div>
                    <div class="col-md-3">
                        <label>状态：</label><?=isset(Yii::$app->params['contract_status'][$model->status])?Yii::$app->params['contract_status'][$model->status]:''?>
                    </div>
                </div>

                <div class="row view-one">
                    <div class="col-md-3">
                        <label>客户名称：</label><?=$model->customer->name?>
                    </div>
                    <div class="col-md-3">
                        <label>销售员：</label><?=$model->saleName?>
                    </div> 
                    <div class="col-md-3">
                        <label>合同币种：</label><?=isset(Yii::$app->params['currency_type'][$model->sale_currency])?Yii::$app->params['currency_type'][$model->sale_currency]:''?>
                    </div>
                    <div class="col-md-3">
                        <label>合同金额：</label><?=$model->sale_price?>
                    </div> 
                </div>

            </div>

            <div class="content-view">
                <div class="row view-one">
                    <div class="col-md-3">
                        <label>收款方式：</label><?=$model->payment_type?>
                    </div>
                    <div class="col-md-3">
                        <label>收款币种：</label><?=isset(Yii::$app->params['currency_type'][$model->pay_currency])?Yii::$app->params['currency_type'][$model->pay_currency]:''?>
                    </div> 
                    <div class="col-md-3">
                        <label>收款金额：</label><?=$model->pay_price?>
                    </div>
                </div>

                <div class="row view-one">
                    <div class="col-md-3">
                        <label>差额币种：</label><?=isset(Yii::$app->params['currency_type'][$model->exchange_currency])?Yii::$app->params['currency_type'][$model->exchange_currency]:''?>
                    </div>
                    <div class="col-md-3">
                        <label>汇兑差额：</label><?=$model->exchange_price?>
                    </div> 
                    <div class="col-md-3">
                        <label>快递号：</label><?=$model->express_num?>
                    </div>
                </div>
            </div>

            <div class="content-view">
                <div class="row view-one">
                    <div class="col-md-3">
                        <label>是否开票：</label>
                        <?php echo Editable::widget([
                                'name'=>'Contract[is_invoice]',
                                'header' => '是否开票',
                                'displayValue' => isset(Yii::$app->params['confirm'][$model->is_invoice]) ? Yii::$app->params['confirm'][$model->is_invoice] : '',
                                'value' => isset(Yii::$app->params['confirm'][$model->is_invoice]) ? Yii::$app->params['confirm'][$model->is_invoice] : '',
                                'formOptions' => ['action'=>Url::toRoute(['/contract/contract/edit','Contract[id]'=>$model->id]),'method'=>'get'],
                                'inputType' => Editable::INPUT_DROPDOWN_LIST,
                                'asPopover' => true,
                                'header' => '是否开票',
                                'data'=> Yii::$app->params['confirm'], 
                                'options' => ['class'=>'form-control'],
                                'displayValueConfig' => Yii::$app->params['confirm']
                            ]);
                        ?>
                    </div>
                    <div class="col-md-3">
                        <label>开票日期：</label>
                        <?php echo Editable::widget([
                            'name' => 'Contract[invoice_date]',
                            'value' => $model->invoice_date,
                            'asPopover' => true,
                            'header' => '开票日期',
                            'inputType' => Editable::INPUT_DATE,
                            'size'=>'md',
                            'formOptions' => ['action'=>Url::toRoute(['/contract/contract/edit','Contract[id]'=>$model->id]),'method'=>'get'],
                            'options' => ['class'=>'form-control',
                                'pluginOptions' => [
                                    'autoclose'=>true,
                                    'format' => 'yyyy-mm-dd'
                                ]
                            ],
                        ]);?>
                    </div> 
                    <div class="col-md-3">
                        <label>开票号：</label>
                        <?php echo Editable::widget([
                            'name' => 'Contract[invoice_no]',
                            'value' => $model->invoice_no,
                            'asPopover' => true,
                            'header' => '开票号',
                            'size'=>'md',
                            'formOptions' => ['action'=>Url::toRoute(['/contract/contract/edit','Contract[id]'=>$model->id]),'method'=>'get'],
                            'options' => ['class'=>'form-control', 'placeholder'=>'开票号'],
                        ]);?>
                    </div>
                </div>

                <div class="row view-one">
                    <div class="col-md-3">
                        <label>开票公司：</label>
                        <?php echo Editable::widget([
                            'name' => 'Contract[invoice_company]',
                            'value' => $model->invoice_company,
                            'asPopover' => true,
                            'header' => '开票公司',
                            'size'=>'md',
                            'formOptions' => ['action'=>Url::toRoute(['/contract/contract/edit','Contract[id]'=>$model->id]),'method'=>'get'],
                            'options' => ['class'=>'form-control', 'placeholder'=>'开票公司'],
                        ]);?>
                    </div>
                    <div class="col-md-3">
                        <label>开票币种：</label>
                        <?php echo Editable::widget([
                                'name'=>'Contract[invoice_currency]',
                                'header' => '开票币种',
                                'displayValue' => isset(Yii::$app->params['currency_type'][$model->invoice_currency]) ? Yii::$app->params['currency_type'][$model->invoice_currency] : '',
                                'value' => isset(Yii::$app->params['currency_type'][$model->invoice_currency]) ? Yii::$app->params['currency_type'][$model->invoice_currency] : '',
                                'formOptions' => ['action'=>Url::toRoute(['/contract/contract/edit','Contract[id]'=>$model->id]),'method'=>'get'],
                                'inputType' => Editable::INPUT_DROPDOWN_LIST,
                                'asPopover' => true,
                                'data'=> Yii::$app->params['currency_type'], 
                                'options' => ['class'=>'form-control'],
                                'displayValueConfig' => Yii::$app->params['currency_type']
                            ]);
                        ?>
                    </div> 
                    <div class="col-md-3">
                        <label>开票金额：</label>
                        <?php echo Editable::widget([
                            'name' => 'Contract[invoice_price]',
                            'value' => $model->invoice_price,
                            'asPopover' => true,
                            'header' => '开票金额',
                            'size'=>'md',
                            'formOptions' => ['action'=>Url::toRoute(['/contract/contract/edit','Contract[id]'=>$model->id]),'method'=>'get'],
                            'options' => ['class'=>'form-control', 'placeholder'=>'开票金额'],
                        ]);?>
                    </div>
                </div>
            </div>

            <div class="content-view">
                <div class="row view-one">
                    <div class="col-md-3">
                        <label>是否回款：</label>
                        <?php echo Editable::widget([
                                'name'=>'Contract[is_back]',
                                'header' => '是否回款',
                                'displayValue' => isset(Yii::$app->params['confirm'][$model->is_back]) ? Yii::$app->params['confirm'][$model->is_back] : '',
                                'value' => isset(Yii::$app->params['confirm'][$model->is_back]) ? Yii::$app->params['confirm'][$model->is_back] : '',
                                'formOptions' => ['action'=>Url::toRoute(['/contract/contract/edit','Contract[id]'=>$model->id]),'method'=>'get'],
                                'inputType' => Editable::INPUT_DROPDOWN_LIST,
                                'asPopover' => true,
                                'header' => '是否回款',
                                'data'=> Yii::$app->params['confirm'], 
                                'options' => ['class'=>'form-control'],
                                'displayValueConfig' => Yii::$app->params['confirm']
                            ]);
                        ?>
                    </div>
                    <div class="col-md-3">
                        <label>回款日期：</label>
                        <?php echo Editable::widget([
                            'name' => 'Contract[back_date]',
                            'value' => $model->back_date,
                            'asPopover' => true,
                            'header' => '回款日期',
                            'inputType' => Editable::INPUT_DATE,
                            'size'=>'md',
                            'formOptions' => ['action'=>Url::toRoute(['/contract/contract/edit','Contract[id]'=>$model->id]),'method'=>'get'],
                            'options' => ['class'=>'form-control',
                                'pluginOptions' => [
                                    'autoclose'=>true,
                                    'format' => 'yyyy-mm-dd'
                                ]
                            ],
                        ]);?>
                    </div> 
                    <div class="col-md-3">
                        <label>回款公司：</label>
                        <?php echo Editable::widget([
                            'name' => 'Contract[back_company]',
                            'value' => $model->back_company,
                            'asPopover' => true,
                            'header' => '回款公司',
                            'size'=>'md',
                            'formOptions' => ['action'=>Url::toRoute(['/contract/contract/edit','Contract[id]'=>$model->id]),'method'=>'get'],
                            'options' => ['class'=>'form-control', 'placeholder'=>'回款公司'],
                        ]);?>
                    </div>
                </div>

                <div class="row view-one">
                    <div class="col-md-3">
                        <label>回款币种：</label>
                        <?php echo Editable::widget([
                                'name'=>'Contract[back_currency]',
                                'header' => '回款币种',
                                'displayValue' => isset(Yii::$app->params['currency_type'][$model->back_currency]) ? Yii::$app->params['currency_type'][$model->back_currency] : '',
                                'value' => isset(Yii::$app->params['currency_type'][$model->back_currency]) ? Yii::$app->params['currency_type'][$model->back_currency] : '',
                                'formOptions' => ['action'=>Url::toRoute(['/contract/contract/edit','Contract[id]'=>$model->id]),'method'=>'get'],
                                'inputType' => Editable::INPUT_DROPDOWN_LIST,
                                'asPopover' => true,
                                'data'=> Yii::$app->params['currency_type'], 
                                'options' => ['class'=>'form-control'],
                                'displayValueConfig' => Yii::$app->params['currency_type']
                            ]);
                        ?>
                    </div>
                    <div class="col-md-3">
                        <label>回款金额：</label>
                        <?php echo Editable::widget([
                            'name' => 'Contract[back_price]',
                            'value' => $model->back_price,
                            'asPopover' => true,
                            'header' => '回款金额',
                            'size'=>'md',
                            'formOptions' => ['action'=>Url::toRoute(['/contract/contract/edit','Contract[id]'=>$model->id]),'method'=>'get'],
                            'options' => ['class'=>'form-control', 'placeholder'=>'回款金额'],
                        ]);?>
                    </div> 
                </div>
            </div>


        </div>      
    </div>

</div>
